﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TestProject
{
    class Program
    {
        static void Main(string[] args)
        {
            Guid g1 = Guid.NewGuid();
            Guid g2 = Guid.NewGuid();
            Guid g3 = Guid.NewGuid();
            Guid g4 = Guid.NewGuid();
            List<Guid> list = new List<Guid>();
            list.Add(g1);
            list.Add(g2);
            list.Add(g3);
            list.Add(g4);
            list.Add(g1);
            list.Add(g2);
            list.Add(g3);
            list.Add(g4);
            list.Add(g1);
            list.Add(g2);

            var aaa = list.Distinct().Select(l => new { A = l, B = list.Count(q => q == l) }).OrderBy(q => -q.B);
            List<Guid> result = aaa.Where(a => a.B >= aaa.First().B).Select(q => q.A).ToList();

            int i = 0;
        }
    }
}
